<!DOCTYPE html>
<html>
 <head>
<script>
/**
 *
 *
 * Copyright 2011, Richard Wagener. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @package    chrome-ondemand-cookie-cleaner
 * @copyright  2011, Richard Wagener. All Rights Reserved.
 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 * @author     Richard Wagener <code@securebucket.com>
 */


if(!localStorage.prefs) {
  localStorage.prefs = JSON.stringify({use_notifications:!0})
}
var lastOpen = "canceled", lastNotification = null;
function notifyIfStatusChange() {
  console.log("notification called");
  var a = JSON.parse(localStorage.prefs);
  console.log("lastOpen:" + lastOpen + " Open:" + open + " Prefs:" + a.use_notifications);
  if(lastOpen && a.use_notifications) {
    lastNotification ? (lastOpen = "canceled", lastNotification.cancel(), lastNotification = null) : (lastOpen = "open", lastNotification = a = webkitNotifications.createNotification("images/icon48.png", localStorage.cookiesRemoved + " cookies removed", 'from "' + localStorage.hostRemoved + '"'), a.show(), localStorage.hostRemoved = null, localStorage.cookiesRemoved = null)
  }
}
chrome.extension.onRequest.addListener(function() {
  notifyIfStatusChange();
  setTimeout(notifyIfStatusChange, 8E3)
});

</script> 
 </head>
<body>
</body>
</html>